package com.cy.controller;

import com.cy.pj.common.pojo.Reponse;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.Pattern;

@RestController
@Validated
public class ArithmeticController {
    @RequestMapping("/doCompute/{n1}/{n2}")
    public Reponse doCompute(@PathVariable  Integer n1,@PathVariable
            @Pattern(regexp = "^[1-9]*$" , message = "信息错误")
            Integer n2){
        Integer result=n1/n2;
        return new Reponse("resultis"+result);
    }
}
//@DecimalMin(value = "1", message = "除数不能为0")